<?php slot('js_insideLoadFunction')?>
ADMIN_FILTER.key_search = '<?php echo __('filter_key_search',null,'table_list')?>';
ADMIN_FILTER.action = {
	error:{
		rowSelectedEmpty: '<?php echo __('error_row_selected', null, 'table_list')?>'
	},
	confirm:{
		deleteConfirm: '<?php echo __('row_delete_confirm', null, 'table_list')?>'
	}
}
ADMIN_FILTER.initFilter();

$('#filter_company_id').val('<?php echo $data['filter']['filter_company_id']?>').attr('selected', true);
$('#filter_is_recruit').val('<?php echo $data['filter']['filter_is_recruit']?>').attr('selected', true);
$('#filter_age_from').val('<?php echo $data['filter']['filter_age_from']?>').attr('selected', true);
$('#filter_gender_id').val('<?php echo $data['filter']['filter_gender_id']?>').attr('selected', true);
$('#filter_age_to').val('<?php echo $data['filter']['filter_age_to']?>').attr('selected', true);
$('#filter_position_id').val('<?php echo $data['filter']['filter_position_id']?>').attr('selected', true);
//$('#filter_search_method_id').val('<?php echo $data['filter']['filter_search_method_id']?>').attr('selected', true);


COMPANY.loading = '<center><img style="margin-top:30px;" src="/css/admin/img/global/ajax-loader.gif"/> &nbsp;<?php echo __('loading_text', null, 'candidate_candidates')?></center>';
COMPANY.actionNameCandidate = '<?php echo ADMIN_DEFINED::SEARCH_CANDIDATE?>';
COMPANY.actionNameJob = '<?php echo ADMIN_DEFINED::SEARCH_JOB?>';
COMPANY.actionNameDelete = '<?php echo ADMIN_DEFINED::APPLY_DELETE?>';
COMPANY.actionNameEdit = '<?php echo ADMIN_DEFINED::APPLY_UPDATE?>';
COMPANY.actionNameInterview = '<?php echo ADMIN_DEFINED::AJAX_LOAD_INTERVIEW?>';
COMPANY.init();

<?php foreach($data['filter']['filter_major_ids'] as $val):?>
$('#mj_<?php echo $val?>').attr('checked','true');
<?php endforeach?>

<?php foreach($data['filter']['filter_education_level_ids'] as $val):?>
$('#lv_<?php echo $val?>').attr('checked','true');
<?php endforeach?>

<?php foreach($data['filter']['filter_location_city_ids'] as $val):?>
$('#ct_<?php echo $val?>').attr('checked','true');
<?php endforeach?>

<?php end_slot()?>

<?php slot('header_css')?>
<script type="text/javascript">
function filterSubmit(){
	$('input.money').each(function(){
		var $ob = $(this);
		$ob.val(MONEY.reverse($ob.val()));
	});
	return true;
}
</script>
<style type="text/css">
<!--
.dt-tbl-ct-border{
	border-collapse: collapse; 
	border-color: #ccc;
	width:950px; 
	border:1px solid #ccc;
	background: #fff;
}

div.box-content-main table.table-list td.name {
	width: 250px;
}

div.box-content-main table.table-list td.area {
	width: 180px;
}
#page-content-right #inner .box-filter input.chkMajor,
#page-content-right #inner .box-filter input.chkLevel{
	margin-top: 3px;
	margin-bottom: 2px;
	width: auto;
	margin-left: 20px;
}
label.chkNAV{
	display: inline-block;
	vertical-align: top;
	padding-top: 2px;
	padding-left: 5px;
}
div.box-content-main table.table-list td.company {
	width: 150px;
}

div.box-content-main table.table-list td.salary {
	width: 120px;
}

div.box-content-main table.table-list td.major {
	width: 180px;
}

label.filter {
	display: inline-block;
	width: 150px;
	margin-left: 30px;
}

select.combo-box {
	width: 150px;
}

select.combo-box-search-method {
	width: 300px;
}


#page-content-right #inner .box-filter input.date-picker,#page-content-right #inner .box-filter input
	{
	margin-top: 3px;
	margin-bottom: 2px;
	width: 138px;
}

#page-content-right #inner .box-filter {
	padding: 20px 10px;
}

.td-border-top {
	border-top: 1px solid #dedede;
}

.td-border-bottom {
	border-bottom: 1px solid #dedede;
}

.info-detail {
	border: 1px solid #dedede;
	padding: 10px;
	background: #fff;
	line-height: 2.5em;
}

.dt-label {
	display: inline-block;
	width: 180px;
}

.dt-lb-content {
	padding: 1px;
	border-bottom: 1px dotted #666;
	display: inline-block;
	width: 200px;
}
.dt-lb-content + .dt-label{
	margin-left:177px;
}
div.dt-lb-content {
	padding: 5px;
	border: 1px dotted #666;
	line-height: normal;
	display: block;
	width: 940px;
}

div.dt-control {
	text-align: right;
	padding: 10px 10px;
}

div.dt-control a {
	color: #00f;
}
-->
</style>
<?php end_slot()?>
<div class="box-navigation">
	<?php echo $data['navigation']?>
</div>
<div class="clr"></div>
<div class="box-filter" style="text-align: left">
	<form action="?" method="get" name="filter_form" id="filter_form" onsubmit="return filterSubmit();">
		<div class="tabs">
			<ul>
				<li><a href="#tabs-1"><?php echo __('filter_basic', null, 'company_jobs')?></a></li>
				<li><a href="#tabs-2"><?php echo __('filter_education_level', null, 'company_jobs')?></a></li>
				<li><a href="#tabs-3"><?php echo __('filter_major', null, 'company_jobs')?></a></li>
				<li><a href="#tabs-4"><?php echo __('filter_location_city', null, 'company_jobs')?></a></li>
			</ul>
			<div id="tabs-1">
				<label class="filter"><?php echo __('label_company_id', null, 'company_jobs')?></label>
				<select name="filter[filter_company_id]" id="filter_company_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_company_id'] as $val):?>
					<option value="<?php echo $val['id']?>"><?php echo $val['company_name']?></option>
					<?php endforeach;?>
				</select> 
				
			
				<label class="filter"><?php echo __('label_position_id', null, 'company_jobs')?></label>
				<select name="filter[filter_position_id]" id="filter_position_id"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php foreach($data['filter_position_id'] as $val):?>
					<option value="<?php echo $val['id']?>"><?php echo $val['name']?></option>
					<?php endforeach;?>
				</select> 
				
				<br /> 
				<label class="filter"><?php echo __('label_age', null, 'company_jobs')?></label>
				<select name="filter[filter_age_from]" id="filter_age_from"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php
					$arr = AdminArrayData::getAgeRange ();
					foreach ( $arr as $k => $v ) :
						?>
						<option value="<?php echo $k ?>"><?php echo $k ?></option>
					<?php endforeach;?>
				</select> 
				
				<label class="filter"><?php echo __('label_age_to', null, 'company_jobs')?></label>
				<select name="filter[filter_age_to]" id="filter_age_to"		class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<?php
					$arr = AdminArrayData::getAgeRange ();
					foreach ( $arr as $k => $v ) :
						?>
						<option value="<?php echo $k ?>"><?php echo $k ?></option>
					<?php endforeach;?>
				</select> 
				
				<br /> 
				<label  class="filter"><?php echo __('option_date_from', null, 'company_jobs')?></label>
				<input type="text" class="date-picker-year filter" data-year-range= "<?php echo sfConfig::get('app_yearRange_minYear').':'.( intval(date('Y',time()))+intval(sfConfig::get('app_yearRange_nextMaxYear')))?>"	name="filter[filter_date_from]" id="filter_date_from"	value="<?php echo $data['filter']['filter_date_from']?>" /> 
				
				<label	 class="filter"><?php echo __('option_date_to', null, 'company_jobs')?></label>
				<input type="text" class="date-picker-year filter"	data-year-range= "<?php echo sfConfig::get('app_yearRange_minYear').':'.( intval(date('Y',time()))+intval(sfConfig::get('app_yearRange_nextMaxYear')))?>" name="filter[filter_date_to]" id="filter_date_to"	value="<?php echo $data['filter']['filter_date_to']?>" /> 
				<br/>
				<label	class="filter"><?php echo __('gender', null, 'candidate_candidates')?></label>
				<select name="filter[filter_gender_id]" id="filter_gender_id"	class="combo-box">
					<option value="-2"><?php echo __('option_all', null, 'table_list')?></option>
					<?php 
					$genders = AdminArrayData::getGender();
					foreach($genders as $k => $val):?>
					<option value="<?php echo $k?>"><?php echo __('gender_'.str_replace('-', '_', $k), null, 'array_data')?></option>
					<?php endforeach;?>
				</select> 
				<!-- 				<label	class="filter"><?php echo __('search_method', null, 'company_jobs')?></label>
				
				<select name="filter[filter_search_method_id]" id="filter_search_method_id"	 class="combo-box">
					
					<?php 
					$searchMethod = AdminArrayData::jobsSearchMethod();
					foreach($searchMethod as $k => $val):?>
					<option value="<?php echo $k?>"><?php echo __('jobsSearch_'.str_replace('-', '_', $k), null, 'array_data')?></option>
					<?php endforeach;?>
				</select> 
				-->
				
				<label	class="filter"><?php echo __('label_is_recruit', null, 'company_jobs')?></label>
				<select name="filter[filter_is_recruit]" id="filter_is_recruit"	class="combo-box">
					<option value="-1"><?php echo __('option_all', null, 'table_list')?></option>
					<option value="0"><?php echo __('is_recruit_0', null, 'company_jobs')?></option>
					<option value="1"><?php echo __('is_recruit_1', null, 'company_jobs')?></option>
				</select> 
				<br/>
				<label	class="filter"><?php echo __('label_salary_from', null, 'company_jobs')?></label>
				<input type="text" class="number filter money" name="filter[filter_salary_from]" id="filter_salary_from"	value="<?php echo intval($data['filter']['filter_salary_from'])?>" /> 
				<!-- 
				<label	class="filter"><?php echo __('label_salary_to', null, 'company_jobs')?></label>
				<input type="text" class="number filter money" name="filter[filter_salary_to]" id="filter_salary_to"	value="<?php echo intval($data['filter']['filter_salary_to'])?>" /> 
				-->
				
				
				<label class="filter"><?php echo __('filter_search_key', null, 'company_jobs')?></label>
				<input style="width: 270px" type="text" maxlength="255"	name="filter[filter_key]" id="filter_key"	value="<?php echo empty($data['filter']['filter_key'])?__('filter_key_search',null,'table_list'):$data['filter']['filter_key']?>" />
				
				
			</div>
			<div id="tabs-2">
				
				<div style="display:inline-block ; width:798px; border:1px dotted #666;padding:0px 20px 20px 20px; margin-top:5px;">
				<?php 
					$count_for_level = 0;
					$loop = 4;
					$total = count($data['filter_level_id']);
					$oneLoop = ceil($total / $loop);
					for($i = 0; $i < $loop; $i++):?>
					<div style="float: left; width: 180px;margin-top:20px;">
					<?php 
						for($j = $i*$oneLoop; $j < $total && $j < ($i + 1) * $oneLoop; $j++):
						$per = $data['filter_level_id'][$j];
						//if(intval($per['level'])<=0) continue;
						?>
						<input class="chkLevel" type="checkbox" id="lv_<?php echo $per['id']?>" value="<?php echo $per['id']?>" name="filter[filter_education_level_ids][]"/><label for="lv_<?php echo $per['id']?>" class="chkNAV"><?php echo $per['name']?></label><br/>
						<?php 
						endfor;?>
						</div>
						<?php
						
					endfor;?>
					<div class="clr"></div>
				</div><div class="clr"></div>
				
				<br />
			</div>
			<div id="tabs-3">
				
				<div style="display:inline-block ; width:798px; border:1px dotted #666;padding:0px 20px 20px 20px; margin-top:5px;">
				<?php 
					$count_for_major = 0;
					foreach ($data['filter_major_id'] as $pro):
						if(count($pro['MasterMajors'])):?>
					<div style="float: left; width: 260px;margin-top:20px;">
						<span><?php echo $pro['name']?></span><br/>
						<?php foreach($pro['MasterMajors'] as $per):?>
							<input class="chkMajor" type="checkbox" id="mj_<?php echo $per['id']?>" value="<?php echo $per['id']?>" name="filter[filter_major_ids][]"/><label for="mj_<?php echo $per['id']?>" class="chkNAV"><?php echo $per['name']?></label><br/>
						<?php endforeach;?>
						
					</div>
					<?php	endif; 
					 echo (++$count_for_major % 3 == 0) ? '<div class="clr"></div>' : '' ?>
				<?php 	endforeach;?>
				</div><div class="clr"></div>
				<br />
			</div>
			<div id="tabs-4">
				<div style="display:inline-block ; width:798px; border:1px dotted #666;padding:0px 20px 20px 20px; margin-top:5px;">
				<?php 
					$count_for_level = 0;
					$loop = 5;
					$total = count($data['filter_location_city_id']);
					$oneLoop = ceil($total / $loop);
					for($i = 0; $i < $loop; $i++):?>
					<div style="float: left; width: 150px;margin-top:20px;">
					<?php 
						for($j = $i*$oneLoop; $j < $total && $j < ($i + 1) * $oneLoop; $j++):
						$per = $data['filter_location_city_id'][$j];
						?>
						<input class="chkMajor" type="checkbox" id="ct_<?php echo $per['id']?>" value="<?php echo $per['id']?>" name="filter[filter_location_city_ids][]"/><label for="ct_<?php echo $per['id']?>" class="chkNAV"><?php echo $per['name']?></label><br/>
						<?php 
						endfor;?>
						</div>
						<?php
						
					endfor;?>
					<div class="clr"></div>
				</div><div class="clr"></div>
				
				
				<br/>
			</div>
		</div>
		<input type="submit"	name="filter[filter_submit]" id="filter_submit" class="button" value="<?php echo __('filter_submit',null,'table_list')?>" />
	</form>
</div>
<div class="clr"></div>
<div class="box-content">
	<form action="<?php echo $data['filter_action']?>" method="post"
		name="form_main" id="form_main">
		<input type="hidden" value="-1" name="action_token" id="action_token" />
		<input type="hidden" value="none" name="action_name" id="action_name" />
		<div class="control">
			<a href="#" class="a-control-get add" 		data-action="<?php echo ADMIN_DEFINED::ADD_RECORD?>"		data-require="none"><?php echo __('control_add',null,'table_list')?></a>
			<a href="#" class="a-control delete"	data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>"	data-require="selected" data-confirm="confirm"><?php echo __('control_delete',null,'table_list')?></a>
		</div>
		<div class="clr"></div>
		<div class="box-content-main">
			<table class="table-list" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td class="head checkbox-select"><input type="checkbox"
						name="select_checkall" id="select_checkall"
						title="<?php echo __('to_checkall',null,'table_list')?>"
						class="chk-select" /></td>
					<td class="head title"><?php echo __('head_title',null,'company_jobs')?></td>
					<td class="head company"><?php echo __('head_company',null,'company_jobs')?></td>
					<td class="head major"><?php echo __('head_major',null,'company_jobs')?></td>
					<td class="head salary"><?php echo __('head_salary',null,'company_jobs')?></td>
					<td class="head area"><?php echo __('head_work_area',null,'company_jobs')?></td>
				</tr>
				
			<?php
			$count_for = 0;
			foreach ( $data ['list'] ['jobs'] as $val ) :
				?>
				<tr
					class="class<?php echo ++$count_for%2?> enable-<?php echo intval($val['is_enabled'])?>">
					<td class="checkbox-select"><input type="checkbox"
						name="select_list[]" class="select_list"
						value="<?php echo $val['id']?>"
						id="select_<?php echo $val['id']?>"
						title="<?php echo __('to_check',null,'table_list')?>" /></td>
					<td class="title"><a href="#"
						data-id="<?php echo $val['id']?>" class="get-detail">
							<?php echo $val['title']?>
						</a></td>
					<td class="company">
						<?php
				$com = CompaniesTable::getDataById ( $val ['company_id'] );
				echo empty ( $com ['company_name'] ) ? 'N/A' : $com ['company_name']?>
					</td>
					<td class="major">
						<?php
				$majors = MasterMajorsTable::getDataListByJobId ( $val ['id'] );
				// echo '<pre>';print_r($majors);echo '</pre>';
				$str = '';
				foreach ( $majors as $m ) :
					echo $str, $m ['name'];
					$str = ', ';
				endforeach
				;
				?>
					</td>
					<td class="salary">
						<?php echo intval($val['salary_payed'])>0?(sfConfig::get('app_currency_symbol').'<span class="money-show">'.$val['salary_payed'].'</span>'):((intval($val['salary_from'])<=0 && intval($val['salary_to'])<=0)?__('label_salary_discuss',null,'company_jobs'):(sfConfig::get('app_currency_symbol').'<span class="money-show">'.$val['salary_from'].'</span> - '.sfConfig::get('app_currency_symbol').'<span class="money-show">'.$val['salary_to'].'</span>'))?>
					</td>
					<td class="area">
						<?php
				$areas = LocationCitiesTable::getDataListByJobId ( $val ['id'] );
				// echo '<pre>';print_r($majors);echo '</pre>';
				$str = '';
				foreach ( $areas as $m ) :
					echo $str, $m ['name'];
					$str = ', ';
				endforeach
				;
				?>
					</td>
				</tr>
				<tr		class="trdetail dtr_<?php echo $val['id']?> class<?php echo $count_for%2?> enable-<?php echo intval($val['is_enabled'])?>">
					<td>&nbsp;</td>
					<td colspan="5" class="td-border-top">
						<div class="job-detail-information"></div>
						<div class="job-interview"></div>
						<div class="candidate-search"></div>
						<div class="dt-control">
							<a href="#" class="ajax-load-interview" ><?php echo __('action_interview',null,'company_jobs')?></a>
							&nbsp; | 
							<?php
								$jPass = JobsTable::getJobNameById($val['id']);
								if(!empty($jPass)){
							?>
							&nbsp;	<a href="#" class="ajax-search-candidate" data-id="<?php echo $val['id']?>"><?php echo __('action_search_candidate',null,'company_jobs')?></a>
							&nbsp; | 
							<?php
								}
							?>
							&nbsp;<a href="#" class="a-control-get edit" data-action="<?php echo ADMIN_DEFINED::EDIT_RECORD?>&id=<?php echo $val['id']?>"data-require="none"><?php echo __('action_edit',null,'table_list')?></a>
							&nbsp; | &nbsp;<a target="_blank" href="<?php echo sfConfig::get('app_prefix').url_for2('company_printer',array('sf_culture'=>$sf_user->getCulture(),'id'=>$val['id'],'action_name'=>ADMIN_DEFINED::AJAX_PRINTER))?>" ><?php echo __('print',null,'table_list')?></a>
						</div>
					</td>
				</tr>
			
				<?php endforeach;?>
				<?php if($count_for ==0):?>
				<tr>
					<td colspan="6">
						<div class="note"><?php echo __('no_row_founded',null,'table_list')?></div>
					</td>
				</tr>
				<?php endif;?>
			</table>
		</div>
		<div class="clr"></div>
		<div class="control">
			<a href="#" class="a-control-get add" 	data-action="<?php echo ADMIN_DEFINED::ADD_RECORD?>" data-require="none"><?php echo __('control_add',null,'table_list')?></a>
			<a href="#" class="a-control delete"		data-action="<?php echo ADMIN_DEFINED::DELETE_RECORD?>			data-require="selected"><?php echo __('control_delete',null,'table_list')?></a>
			
		</div>
		<?php if(count($data['pagination_pager'])>1):?>
		<div class="pagination">
			<span><?php echo __('pagination_text',null,'table_list')?></span> <span
				class="pagination"> 
			<?php foreach ($data['pagination_pager'] as $p):?>
				<a
				href="<?php echo empty($p['url'])?'#':($data['app_prefix'].$p['url'])?>"
				class="<?php echo $p['page_class']?>"><?php echo $p['page_num']?></a>
			<?php endforeach;?>
			</span>
			<div class="clr"></div>
		</div>
		<?php endif;?>
		<div class="clr"></div>
	</form>
</div>